package com.lovo.consumerSys.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lovo.consumerSys.entity.ConsumerEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

/**
 * 消费者mapper接口
 */
@Mapper
public interface IConsumerMapper extends BaseMapper<ConsumerEntity> {
    /**
     * 查询消费者的个人信息
     * @return
     */
    @Select("select * from sys_consumer")
    @ResultMap("consumerMap")
    public ConsumerEntity findAllInfo();


    /**
     * 消费者修改个人信息
     * @param consumerId    消费者id
     * @param consumerEntity    消费者对象
     * @return
     */
    @Update("update sys_consumer " +
            "set consumerName=#{consumerEntity.consumerName},phone=#{consumerEntity.phone},password=#{consumerEntity.password},headImage=#{consumerEntity.headImage} " +
            "where pk_consumerId=#{consumerId}")
    public void updateConsumerInfo(long consumerId,ConsumerEntity consumerEntity);
}
